import common from './common'

const paths = {
  getAllScriptList: 'script/searchScript',
  saveDataMappingTemplate: 'dataMappingTemplate/save',
  getDataMappingTemplateById: 'dataMappingTemplate/getById',
  listAllDataMappingTemplates: 'dataMappingTemplate/listAll',
  deleteDataMappingTemplateById: 'dataMappingTemplate/deleteById'
}

const dataMappingService = {};

(service => {
  service.getAllScriptList = (params, data) => {
    return common.post(paths.getAllScriptList, params, data)
  }

  service.saveDataMappingTemplate = (data) => {
    return common.post(paths.saveDataMappingTemplate, null, data)
  }

  service.getDataMappingTemplateById = (params) => {
    return common.get(paths.getDataMappingTemplateById, params)
  }

  service.listAllDataMappingTemplates = () => {
    return common.get(paths.listAllDataMappingTemplates, {})
  }

  service.deleteDataMappingTemplateById = (params) => {
    return common.get(paths.deleteDataMappingTemplateById, params)
  }
})(dataMappingService)

export default dataMappingService
